package com.itheima.mall.web.sms;

import com.itheima.mall.pojo.sms.Coupon;
import com.itheima.mall.pojo.sms.CouponHistory;
import com.itheima.mall.service.sms.CouponHistoryService;
import com.itheima.mall.vo.PageResult;
import com.itheima.mall.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("couponHistory")
public class CouponHistoryController {
    @Autowired
    private CouponHistoryService couponHistoryService;

    //根据优惠券id，使用状态，订单编号分页获取领取记录
    @GetMapping("list")
    public R<PageResult<CouponHistory>> list(Integer couponId,
                                             String orderSn,
                                             Integer pageNum,
                                             Integer pageSize,
                                             Integer userStatus){
        PageResult pr=couponHistoryService.list(couponId,orderSn,pageNum,pageSize,userStatus);
        return R.succeed(pr,"分页成功");
    }
}
